package com.aspose.cells;

class zcay {
   private Workbook a;
   private zcda b;
   private zbxz c;
   private Worksheet d;
   private zpa e;
   private zoz f;
   private int g;
   private byte[] h;
   private int i;
   private Cells j;

   zcay(zcda var1) {
      this.b = var1;
      this.a = var1.a;
      this.f = var1.b;
   }

   void a(zpa var1, zbxz var2) throws Exception {
      this.e = var1;
      this.d = var1.d;
      this.j = this.d.getCells();
      this.d.setType(2);
      this.d.getCharts().a(new Chart(this.d));
      this.c = var2;

      while(true) {
         this.g = this.c.a();
         switch(this.g) {
         case 130:
            this.c.a(1L);
            return;
         case 139:
            this.b();
            break;
         case 476:
            this.d();
            break;
         case 479:
            this.f();
            break;
         case 550:
            this.h = this.b.a(this.c);
            var1.h = zcch.d(this.h, 0);
            break;
         case 551:
            this.h = this.b.a(this.c);
            var1.f = zcch.d(this.h, 0);
            break;
         case 552:
            this.h = this.b.a(this.c);
            var1.g = zcch.d(this.h, 0);
            break;
         case 562:
            this.h = this.b.a(this.c);
            var1.i = zcch.d(this.h, 0);
            break;
         case 651:
            this.a();
            break;
         case 652:
            this.e();
            break;
         case 669:
            this.c();
            break;
         default:
            this.i = this.c.b();
            this.c.a((long)this.i);
         }
      }
   }

   private void a() throws Exception {
      this.h = this.b.a(this.c);
      boolean var1 = false;
      boolean[] var2 = new boolean[]{var1};
      zakp var3 = zcdp.a(this.h, 2, (boolean[])var2);
      var1 = var2[0];
      if (!var1 && !var3.a()) {
         this.d.setTabColor(var3.b(this.a));
      }

      this.d.k = zcch.d(this.h, 10);
   }

   private void b() {
      this.c.a(1L);
      zbcj var1 = new zbcj(this.d);
      this.d.a(var1);

      while(true) {
         this.g = this.c.a();
         switch(this.g) {
         case 141:
            this.h = this.b.a(this.c);
            this.d.setSelected((this.h[0] & 255 & 1) != 0);
            this.d.setZoom(com.aspose.cells.b.a.zc.a(this.h, 2));
            break;
         case 142:
            this.c.a(1L);
            return;
         default:
            this.i = this.c.b();
            this.c.a((long)this.i);
         }
      }
   }

   private void c() {
      this.h = this.b.a(this.c);
      Protection var1 = this.d.getProtection();
      var1.a(com.aspose.cells.b.a.zc.e(this.h, 0));
      var1.setAllowEditingContent(this.h[2] == 0);
      var1.setAllowEditingObject(this.h[6] == 0);
   }

   private void d() {
      this.h = this.b.a(this.c);
      PageSetup var1 = this.d.getPageSetup();
      var1.setLeftMarginInch(com.aspose.cells.b.a.zc.f(this.h, 0));
      var1.setRightMarginInch(com.aspose.cells.b.a.zc.f(this.h, 8));
      var1.setTopMarginInch(com.aspose.cells.b.a.zc.f(this.h, 16));
      var1.setBottomMarginInch(com.aspose.cells.b.a.zc.f(this.h, 24));
      var1.setHeaderMarginInch(com.aspose.cells.b.a.zc.f(this.h, 32));
      var1.setFooterMarginInch(com.aspose.cells.b.a.zc.f(this.h, 40));
   }

   private void e() {
      this.h = this.b.a(this.c);
      PageSetup var1 = this.d.getPageSetup();
      if ((this.h[18] & 255 & 2) == 0) {
         var1.setPaperSize(com.aspose.cells.b.a.zc.a(this.h, 0));
         var1.e(com.aspose.cells.b.a.zc.a(this.h, 4));
         var1.f(com.aspose.cells.b.a.zc.a(this.h, 8));
         if ((this.h[18] & 255 & 8) == 0) {
            var1.setOrientation((this.h[18] & 255 & 1) != 0 ? 0 : 1);
         }
      }

      if ((this.h[18] & 255 & 16) != 0) {
         var1.setFirstPageNumber(com.aspose.cells.b.a.zc.b(this.h, 16));
         var1.setAutoFirstPageNumber(false);
      }

      var1.setBlackAndWhite((this.h[18] & 255 & 4) != 0);
      var1.setPrintDraft((this.h[18] & 255 & 32) != 0);
   }

   private void f() throws Exception {
      this.h = this.b.a(this.c);
      PageSetup var1 = this.d.getPageSetup();
      var1.a(this.h[0]);
      byte var3 = 2;
      int[] var4 = new int[]{var3};
      String var5 = zcch.a(this.h, var4);
      int var7 = var4[0];
      String[] var2;
      int var6;
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setHeader(var6, var2[var6]);
            }
         }
      }

      var4[0] = var7;
      var5 = zcch.a(this.h, var4);
      var7 = var4[0];
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setFooter(var6, var2[var6]);
            }
         }
      }

      var4[0] = var7;
      var5 = zcch.a(this.h, var4);
      var7 = var4[0];
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setEvenHeader(var6, var2[var6]);
            }
         }
      }

      var4[0] = var7;
      var5 = zcch.a(this.h, var4);
      var7 = var4[0];
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setEvenFooter(var6, var2[var6]);
            }
         }
      }

      var4[0] = var7;
      var5 = zcch.a(this.h, var4);
      var7 = var4[0];
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setFirstPageHeader(var6, var2[var6]);
            }
         }
      }

      var4[0] = var7;
      var5 = zcch.a(this.h, var4);
      var7 = var4[0];
      if (var5 != null && !"".equals(var5)) {
         var2 = zasp.a(var5);

         for(var6 = 0; var6 < var2.length; ++var6) {
            if (var2[var6] != null) {
               var1.setFirstPageFooter(var6, var2[var6]);
            }
         }
      }

   }
}
